package com.ocm.warehouse.mqListener;


import com.ocm.warehouse.service.IStockService;
import com.rabbitmq.client.Channel;
import com.ocm.mq.annotation.RabbitAutoAck;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author hqy
 * @Date 18/01/2022
 * @Description
 */
@Component
public class StockListener {


	@Resource
	private IStockService stockService;


	@RabbitAutoAck
	@RabbitListener(queues = "received.stock.received.queue")
	public void stockReceivingListen(Long orderId, Channel channel, Message message){
		//根据orderId 发货 扣减库存
		stockService.stockReceiving(orderId);

	}



}
